﻿using System;
using System.Linq;
using System.Linq.Expressions;

namespace mForum.Domain.Specification
{
    using mForum.Core.Specification;
    using mForum.Domain.DomainObject;

    public class UserEmailSpecification : Specification<User>
    {
        private string _email;

        public UserEmailSpecification(string email)
        {
            if(string.IsNullOrEmpty(email))
                throw new ArgumentNullException("email");

            _email = email;
        }

        public override Expression<Func<User, bool>> SatisfiedBy()
        {
            return x => x.Email == _email;
        }
    }
}
